Release 10.1A: OpenEdge Development:
ADM and SmartObjects
AppBuilder modifications to the SmartDataObject master
When you generate the master (
.wfile) for the SmartDataObject that has been set up for conditional compilation into database-aware and nondatabase-aware versions, the AppBuilder modifies the master as follows:
- It checks each code-block section to see whether its DB-REQUIRED toggle box is checked. If it is, the AppBuilder brackets the code in that section with the following preprocessor names:
These preprocessor names resolve to the following code:
This code excludes the section from the r-code during the compilation of the client proxy.
If the section’s DB Required toggle box is unchecked, the AppBuilder does not bracket its code with the
{&DB-REQUIRED-START}and{&DB-REQUIRED-END}preprocessor names, and the section is included in the r-code during the compilation.- If the preprocessor names for a section are present, the AppBuilder generates the following code to define them before it produces any code block that might require them:
If
DB-REQUIREDis not defined when the compiler processes this block of code, all code blocks are included in the compiled r-code. However, ifDB-REQUIREDis defined as false, code blocks bracketed with{&DB-REQUIRED-START}and{&DB-REQUIRED-END}are not included in the compiled r-code. This is the case when generating a client proxy (a SmartDataObject proxy to be used on a client machine); it means that the proxy is not required to be connected to any database when executed.You can choose to compile out just a part of an internal procedure or function. To do this, uncheck the DB-REQUIRED toggle box and program the following statements around the section of code to be executed only when a database connection is available:
This technique allows you to execute different versions of the same procedure on the client and the AppServer. You might even code the client version to invoke the AppServer version; for an example, see the installed file
%DLC%\src\adcm2\cltorsrver.i(Windows) or$DLC/src/adcm2/cltorsrver.i(UNIX)- When it generates the
.wfile for the SmartDataObject, the AppBuilder also produces a client proxy.wfile. The proxy has the same name of the formsdoname_cl.w, wheresdonameis the name of the SmartDataObject. For example, a SmartDataObject nameddcust.wautomatically has a proxy nameddcust_cl.w. The proxy contains the following code:
This code, when compiled, first sets
{&DB-REQUIRED}toFALSE, then creates an r-code proxy nameddcust_cl.rthat is identical to its sibling SmartDataObject nameddcust.rexcept all sections markedDB-REQUIREDare removed.- The AppBuilder turns on the SmartDataObject’s
DBAwareattribute. It uses this attribute later, when it generates a SmartContainer that contains the SmartDataObject.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |